import tpl from './index.tpl';
import './index.scss';
import {
  tplReplace
} from '../../../utils/tools';

export default () => {
  return {
    name: 'list',
    tpl(data) {
      let list = '';
      data.forEach((item) => {
        list += tplReplace(tpl, {
          id: item.id,
          courseName: item.course_name,
          price: item.price === '0' ? '免费' : '￥' + item.price,
          img: item.img
        });
      });
      return list;
    }
  }
}